﻿using System;
using System.Collections.Generic;
using System.Configuration;

namespace Alex.Library.Log.Configuration
{
    public abstract class LoggerElement : ConfigurationElement
    {
        /// <summary>
        /// name属性
        /// </summary>
        [ConfigurationProperty("name", IsRequired = true, IsKey = true)]
        public string Name
        {
            get
            {
                return (string)this["name"];
            }
        }

        /// <summary>
        /// 日志模板
        /// </summary>
        [ConfigurationProperty("template", IsRequired = false)]
        public TemplateElement Template
        {
            get
            {
                return (TemplateElement)this["template"];
            }
        }

        /// <summary>
        /// 输出日志的最低级别
        /// </summary>
        [ConfigurationProperty("flushLevel", IsRequired = false)]
        public FlushLevelContentElement FlushLevel
        {
            get
            {
                return (FlushLevelContentElement)this["flushLevel"];
            }
        }

        /// <summary>
        /// 根据配置生成Logger对象
        /// </summary>
        /// <returns></returns>
        public abstract ILogger GetLogger();
        
    }
}
